<!--部门发文申请-->
<table class="table table-bordered">
    <tbody>
    <tr>
        <td style="vertical-align:middle;text-align: center; " >流水号</td>
        <td><input type="text" class="form-control" id="number" name="number" readonly="readonly"/></td>
        <td colspan="4"></td>
    </tr>
    <tr>
        <td style="vertical-align:middle;text-align: center; ">拟稿人</td>
        <td><input type="text" class="form-control" oninvalid="setCustomValidity('拟稿人不允许为空')" required oninput="preSubmit(this)"   id="draPeople" name="draPeople" /></td>
        <td style="vertical-align:middle;text-align: center; ">所属部门</td>
        <td><input type="text" class="form-control" oninvalid="setCustomValidity('所属部门不允许为空')" required oninput="preSubmit(this)"  id="dept" name="dept" /></td>
        <td style="vertical-align:middle;text-align: center; ">申请日期</td>
        <td><input type="text" class="form-control" required  oninput="preSubmit(this)"  id="startTime" name="startTime"/></td>
    </tr>
    <tr>
        <td style="vertical-align:middle;text-align: center; ">文件名称</td>
        <td><input type="text" class="form-control" oninput="preSubmit(this)" oninvalid="setCustomValidity('文件名称不允许为空')" required id="fileName" name="fileName" /></td>
        <td style="vertical-align:middle;text-align: center; ">发文字号</td>
        <td colspan="3"><input type="text" class="form-control" oninput="preSubmit(this)" oninvalid="setCustomValidity('发文字号不允许为空')" required id="textNumber" name="textNumber" /></td>
    </tr>
    <tr>
        <td style="vertical-align:middle;text-align: center; ">主送部门</td>
        <td colspan="5"><input type="text" class="form-control" oninput="preSubmit(this)" oninvalid="setCustomValidity('主送部门不允许为空')" required id="soDept" name="soDept" /></td>
    </tr>
    <tr>
        <td style="vertical-align:middle;text-align: center; ">重要程度</td>
        <td style="vertical-align:middle;text-align: center; ">
            <select class="form-control"  name="import"  oninput="preSubmit(this)" oninvalid="setCustomValidity('请选择重要程度')" required>
            <option value="">请选择</option>
            <option value="1" >低</option>
            <option value="2" >一般</option>
            <option value="3" >高</option>
            </select></td>
        <td style="vertical-align:middle;text-align: center; ">紧急程度</td>
        <td style="vertical-align:middle;text-align: center; ">
            <select class="form-control" name="qucik"  oninput="preSubmit(this)" oninvalid="setCustomValidity('请选择紧急程度')" required>
            <option value="">请选择</option>
            <option value="1" >低</option>
            <option value="2" >一般</option>
            <option value="3" >高</option>
             </select></td>
        <td style="vertical-align:middle;text-align: center; ">附件数量</td>
        <td style="vertical-align:middle;text-align: center; ">
            <input  type="text" class="form-control" id="attach" name="attach"  oninput="preSubmit(this)" pattern="^\d+$" required/>份</td>
    </tr>
    <tr>
        <td style="vertical-align:middle;text-align: center; ">内容概要</td>
        <td colspan="5"><textarea class="form-control" name="text" rows="5"  oninput="preSubmit(this)" oninvalid="setCustomValidity('内容概要不能为空')" required></textarea></td>
    </tr>
    </tbody>
</table>

<script>
    $(function () {
        function S4() {
            return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
        }
        function guid() {
            return (S4() + S4() + S4());
        }
        var myID =guid();
        console.log(myID)
        $("#number").val(myID)
    })


    /**
     * 重写表单提交前事件
     * @returns {boolean}
     */
    function preSubmit(i) {
        if(i.validity.patternMismatch ===true){
            i.setCustomValidity("请输入数字");
            i.validationMessage("请输入数字");
        }
          i.setCustomValidity("");
    }

    layui.use('laydate', function(){
        var laydate = layui.laydate;
        laydate.render({
            elem: '#startTime'
        });
    });

</script>
